<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="root">
        <child content="wangjunl"></child>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        Vue.component('child', {
            // props:["content"],

            // props: {
            //     content: String
            // },

            // props: {
            //     content: [String, Number] 
            // },

            // props:{
            //     content:{
            //         type:String,
            //         required:true,
            //         default:'default value'
            //     }
            // },
            
            props:{
                content:{
                    type:String,
                    validator:function(value){
                        return (value.length>5)
                    }
                }
            },
            template: "<div @click='handleClick'>{{content}}</div>",
            methods: {
                handleClick: function () {
                    console.log(typeof (this.content));
                }
            }
        })
        var app = new Vue({
            el: "#root"
        })
    </script>
</body>

</html>